package com.jsoft.model;

import com.jsoft.dto.ServiceDto;
import com.jsoft.model.core.BaseDao;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * Date: 15.08.13
 * Time: 14:50
 */

@Entity
@Table(name = "services")
public class ServiceDao extends BaseDao {
    @Column(name = "name")
    private String name;
    @Column(name = "value")
    private BigDecimal value;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getValue() {
        return value;
    }

    public void setValue(BigDecimal value) {
        this.value = value;
    }

    public ServiceDto wrapServiceDto() {
        ServiceDto dto = new ServiceDto();
        dto.setObjectId(this.getObjectId());
        dto.setName(this.getName());
        dto.setValue(this.getValue());
        return dto;
    }

    public ServiceDao wrapServiceDao(ServiceDto dto) {
        ServiceDao dao = new ServiceDao();
        dao.setName(dto.getName());
        dao.setValue(dto.getValue());
        return dao;
    }
}
